<?php
namespace Api;

use Closure;

class LanguageMiddleware
{
    public function handle($request, Closure $next)
    {
        $lang = $request->headers->get('lang', 'zh');
        app('translator')->setLocale($lang);
        return $next($request);
    }
}